package com.xmkj.jijidriver.mine.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;
import com.common.mvp.BaseMvpActivity;
import com.common.mvp.BasePresenter;
import com.xmkj.jijidriver.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by chen on 2018/4/1.
 */

public class FaPiaoApplyActivity extends BaseMvpActivity {
    @BindView(R.id.iv_next)
    ImageView mIvNext;
    @BindView(R.id.tv_fapiao_type)
    TextView mTvFapiaoType;
    @BindView(R.id.rl_choose)
    RelativeLayout mRlChoose;
    private List<String> siteTypeStrList = new ArrayList<>();
    private OptionsPickerView siteTypePicker;
    @Override
    protected BasePresenter createPresenterInstance() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_fapiao_apply;
    }

    @Override
    protected void onViewCreated() {

    }

    @Override
    protected void doLogicFunc() {
        attachClickListener(mRlChoose);
        initTypeOptionsPicker();
    }
    private void initTypeOptionsPicker() {
        siteTypeStrList.clear();
        siteTypeStrList.add("专用");
        siteTypeStrList.add("普通");

        siteTypePicker = new OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() {

            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                if (options1 == 0) {
//                    person_sex = "1";//男的
                } else if (options1 == 1) {
//                    person_sex = "2";
                }
                mTvFapiaoType.setText(siteTypeStrList.get(options1));
                gotoActivity(FaPiaoApplyDetailsActivity.class);

            }
        }).setSubmitText(getString(R.string.insure)).
                setCancelText(getString(R.string.cacal)).
                build();
        siteTypePicker.setPicker(siteTypeStrList);
    }
    @Override
    protected void onViewClicked(View view) {
        if (view.getId() == mRlChoose.getId()) {
            if (siteTypePicker != null) {
                siteTypePicker.show();
            } 
        }
    }

    @Override
    protected void setNavigation() {
        setNavigationBack("发票申请");
    }


    @Override
    public void bindKnife() {
        ButterKnife.bind(this);
    }
}
